package Opter;

import Libray.Book;
import Libray.BookShelf;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: xwl
 * Date: 2023-04-16
 * Time: 14:16
 */
public class LendOpter implements IOpter{
    @Override
    public void opterFun(BookShelf bookShelf, String name) {
        // 接收
        Book[] books = bookShelf.getBooks();
        //
        for (int i = 0; i < bookShelf.getBookNum(); i++) {
            if (name.equals(books[i].getBookName())) {
                books[i].setBookFlag(true);
                System.out.println("操作已完成，已借书");
                break;
            } else if (i == bookShelf.getBookNum() - 1) {
                System.out.println("输错名字，请重新核对");
            }
        }
    }
}
